<nz-breadcrumb class="breadcrumb">
  <nz-breadcrumb-item>
    <a>首页</a>
  </nz-breadcrumb-item>
  <nz-breadcrumb-item>费用信息列表</nz-breadcrumb-item>
</nz-breadcrumb>
<form nz-form class="search-form" [formGroup]="searchForm" (keydown.enter)="$event.preventDefault();onSearch()" nzLayout="inline">
  <nz-form-item>
    <nz-form-label nzFor="roomNumber">房间号</nz-form-label>
    <nz-form-control>
      <nz-input-group nzSearch [nzAddOnAfter]="roomNumberSuffixIconButton">
        <input nz-input formControlName="roomNumber" placeholder="请选择房间号" readonly />
      </nz-input-group>
      <ng-template #roomNumberSuffixIconButton>
        <button nz-button nzType="primary" nzSearch (click)="findDormitoryRoom()"><nz-icon nzType="search" /></button>
      </ng-template>
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label nzFor="studentName">学生姓名</nz-form-label>
    <nz-form-control>
      <nz-input-group nzSearch [nzAddOnAfter]="studentNameSuffixIconButton">
        <input nz-input formControlName="studentName" placeholder="请选择学生姓名" readonly />
      </nz-input-group>
      <ng-template #studentNameSuffixIconButton>
        <button nz-button nzType="primary" nzSearch (click)="findStudent()"><nz-icon nzType="search" /></button>
      </ng-template>
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label nzFor="feeType">费用类型</nz-form-label>
    <nz-form-control>
      <nz-select formControlName="feeType" class="custom-select-width">
        <nz-option nzLabel="住宿费" [nzValue]="10"></nz-option>
        <nz-option nzLabel="网费" [nzValue]="20"></nz-option>
        <nz-option nzLabel="水费" [nzValue]="30"></nz-option>
        <nz-option nzLabel="电费" [nzValue]="40"></nz-option>
      </nz-select>
    </nz-form-control>
  </nz-form-item>
  <button nz-button type="button" nzType="primary" [nzLoading]="searchLoading" (click)="onSearch()">查询</button>
  <button nz-button type="button" class="margin-button" (click)="onReset()">重置</button>
  <button nz-button type="button" class="margin-button" nzType="primary" (click)="onAdd()">新增</button>
  <button nz-button type="button" class="margin-button" nzType="primary" [nzLoading]="searchLoading" (click)="onExport()">导出</button>
</form>
<nz-table #basicTable [nzData]="listOfData" [nzTotal]="total" [nzLoading]="searchLoading" nzSize="small">
  <thead>
    <tr>
      <th>房间号</th>
      <th>学生姓名</th>
      <th>费用类型</th>
      <th>收费周期类型</th>
      <th>收费周期</th>
      <th>费用金额</th>
      <th nzWidth="250px">操作</th>
    </tr>
  </thead>
  <tbody>
    <tr *ngFor="let data of basicTable.data">
      <td>{{data.roomNumber}}</td>
      <td>{{data.studentName}}</td>
      <td>
        <ng-container *ngIf="data.feeType === 10">住宿费</ng-container>
        <ng-container *ngIf="data.feeType === 20">网费</ng-container>
        <ng-container *ngIf="data.feeType === 30">水费</ng-container>
        <ng-container *ngIf="data.feeType === 40">电费</ng-container>
      </td>
      <td>
        <ng-container *ngIf="data.feePeriodType === 10">月度</ng-container>
        <ng-container *ngIf="data.feePeriodType === 20">年度</ng-container>
        <ng-container *ngIf="data.feePeriodType === 30">季度</ng-container>
      </td>
      <td>{{data.feePeriod}}</td>
      <td>{{data.feeAmount}}</td>
      <td>
        <button nz-button type="button" nzType="primary" (click)="editRow(data.id)">编辑</button>
        <button nz-button type="button" nzDanger class="margin-button" (click)="delRow(data.id)">删除</button>
        <button nz-button type="button" class="margin-button" (click)="detailRow(data)">详情</button>
      </td>
    </tr>
  </tbody>
</nz-table>
<dormitory-room-selector (dormitoryRoomSelectedEvent)="handleDormitoryRoomSelectedEvent($event)"></dormitory-room-selector>
<student-selector (studentSelectedEvent)="handleStudentSelectedEvent($event)"></student-selector>
<dormitory-fee-add (addedEvent)="onAdded($event)"></dormitory-fee-add>
<dormitory-fee-view></dormitory-fee-view>
